$(function () {

    var userId = Cookies.get("userId");

    $("#job-submit").click(function () {
        var jobTitle = $("#job-title").val();
        var department = $("#department").val();
        var phoneNumber = $("#mobile").val();
        var email = $("#email").val();
        var jobDescribe = $("#job-describe").val();
        var requirement = $("#requirement").val();
        var salary = $("#salary").val();
        $.ajax({
            type:"post",
            url: "/work/addJob",
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify({
                "publishUserId": userId,
                "jobTitle": jobTitle,
                "department": department,
                "phoneNumber": phoneNumber,
                "email": email,
                "jobDescribe": jobDescribe,
                "requirement": requirement,
                "hourlyWage": salary
            }),
            success: function (result) {
                $("#warning-fade").html(result.statusInfo);
                $("#myModal").modal();
                if(result.statusNum == 200){
                    window.location.href="index.html";
                }
            },
            error: function (){
                $("#warning-fade").html("服务请求失败！");
                $("#myModal").modal();
            }
        });
    });

});